package com.lovo.demo02.packResult;

import jdk.jshell.MethodSnippet;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.invoke.MethodHandle;
import java.lang.reflect.Method;

@Aspect
@Component
public class AspectOfController {
    @AfterThrowing(value = "execution(* com.lovo.demo02.service..*(..))",throwing =  "e")
    public void serviceException(Throwable e) throws MyException {
        e.printStackTrace();
        throw new MyException(ResoultCode.SERVICE_ERROR);
    }

    @Around(value = "execution(* com.lovo.demo02.controller..*(..))")
    public Object controllerException(ProceedingJoinPoint joinPoint){
        Object object;
        Class clszz;
        Method method;
//        try{
//            Signature m =  joinPoint.getSignature();
//            MethodSignature methodSignature = ()m;
//            clszz =
//        }
        return null;
    }
}
